<?php
/*
 * @Author: 李志刚
 * @CopyRight: 2020-2030 衡水山木枝技术服务有限公司
 * @Date: 2021-06-10 17:31:25
 * @Description: 供应商员工
 * @LastEditors: 李志刚
 * @LastEditTime: 2021-07-06 09:06:48
 * @FilePath: /qingshanERP/app/Models/QingShanERP/SupplierStaff.php
 */

namespace App\Models\QingShanERP;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class SupplierStaff extends Model
{
    use HasFactory;
    /**
     * 关联到模型的数据表
     *
     * @var string
     */
    protected $table = 'supplier_staffs';

    // 不可以批量赋值的字段，为空则表示都可以
    protected $guarded = [];

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = [];

    /**
     * 表明模型是否应该被打上时间戳
     *
     * @var bool
     */
    public $timestamps = true;

    /**
     * 应该被转换成原生类型的属性。
     *
     * @var array
     */
    protected $casts = [
        'status' => 'boolean',
    ];
    // 管理供货商
    public function supplier(){
        return $this->belongsTo('\App\Models\QingShanERP\Supplier', 'supplier_id', 'id');
    }
    public function order()
    {
        return $this->hasMany('\App\Models\QingShanERP\Order', 'supplier_staff_id', 'id');
    }
}
